// CurrRecordManager.h: interface for the CurrRecordManager class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CURRRECORDMANAGER_H__C4E635FD_F586_4940_ACBB_5E3D3149E48D__INCLUDED_)
#define AFX_CURRRECORDMANAGER_H__C4E635FD_F586_4940_ACBB_5E3D3149E48D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "CommonLib\RecordManager.h"

class CurrRecordThread;

class CurrRecordManager //: public BaseRecordManager
{
protected:
	CurrRecordManager();
	virtual ~CurrRecordManager();

public:
	static CurrRecordManager * Instance();
	static void DeleteInstance();

	void Init();
	void Cleanup();
	CurrRecordThread * CreateCurrRecordThread();
	void DestroyCurrRecordThread();

	void AppendCurrRecord(const CurrRecord& er);
	bool TakeCurrRecord(CurrRecord& er);
	void DeleteAllRecords();
	bool DeleteUnusedData(CurrRecord er);

public:
	int  GetRecordCount();

	const std::vector<long *>& GetCoalMineUnusedIds() const {return m_nCoalMineUnusedIds;}
	void AppendCoalMineUnusedId(const long& nCoalMineId);
	void TakeCoalMineUnusedId(long& nCoalMineId);
	void DeleteAllCoalMineUnusedIds();

	CEvent m_eventDBInit;

protected:
	CurrRecordThread * m_pCurrRecordThread;
	CMutex m_mutexRecords;

	std::vector< CurrRecord *> m_CurrRecords;
	std::vector<long *> m_nCoalMineUnusedIds;

private:
	static CurrRecordManager * m_pInstance;
};

#endif // !defined(AFX_CURRRECORDMANAGER_H__C4E635FD_F586_4940_ACBB_5E3D3149E48D__INCLUDED_)
